import Vue from 'vue';
import App from './App.vue';

import Home from './components/Home.vue'
import Shop from './components/Shop.vue'
import Order from './components/Order.vue'
import Cart from './components/Cart.vue'
import NotFound from './components/NotFound.vue'
import TopNav from './components/TopNav.vue'
import TopBar from './components/TopBar.vue'
import Layout from './components/Layout.vue'

import VueRouter from 'vue-router';
const router = new VueRouter({
  // 路由表
  routes: [
    {
      path: '/a',
      component: Layout,
      children: [
        {
          path: 'b',
          name: 'Home',
          components: {
            default: Home,
            v1: Cart,
            v2: Shop,
          },
          children: [
            {
              path: 'c',
              components: {
                default: TopBar,
                c1: TopNav
              },
            }
          ]
        },
      ]
    },

    {
      path: '*',
      component: NotFound,

    },
  ]
});
// 注册组件 <router-view> <router-link>
Vue.use(VueRouter);

new Vue({
  el: '#app',
  router,//路由表
  render: h => h(App),
});